import { create } from 'zustand'
import { getGlobalInfo } from '../apis/global'

type GlobalInfo = {
    title: string
}

type GlobalInfoState = {
    status: { loading: true } | { loading: false, data: GlobalInfo },
    load: () => void
}

export const useGlobalInfoStore = create<GlobalInfoState>((set) => ({
    status: { loading: true },
    load: () =>getGlobalInfo().then(it => set({ status: {loading: false, data: it as GlobalInfo} }))
}))